home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
tcprogud.sit
/
TC Prog Guide
/
card_32640.txt
< prev
next >
Wrap
Text File
|
1991-02-27
|
758b
|
28 lines
-- card: 32640 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 4755
-- name:
-- part contents for background part 4
----- text -----
void square_array(float *f_array)
{
*f_array = (*f_array) * (*f_array);
*(f_array+1) = (*(f_array+1)) * (*(f_array+1));
*(f_array+2) = (*(f_array+2)) * (*(f_array+2));
}
An equivalent definition which is more appropriate in this case takes advantage of the use of array indexing in place of pointer arithmetic:
void square_array(float f_array[])
{
f_array[0] = f_array[0] * f_array[0];
f_array[1] = f_array[1] * f_array[1];
f_array[2] = f_array[2] * f_array[2];
}
-- part contents for background part 7
----- text -----
91